var maxProfit = function (prices, fee) {
  // 初始利润
  let profit_in = 0 - prices[0];
  let profit_out = 0;
  for (let i = 0; i < prices.length; i++) {
    profit_out = Math.max(profit_out, profit_in + prices[i] - fee);
    profit_in = Math.max(profit_in, profit_out - prices[i]);
  }
  return profit_out;
}